Repository navigation
fix UninitBufferVec to use shader's size for each entry instead of Ru… - #26090
Merged
mockersf merged 1 commit intoOct 12, 2026
Merged
Conversation
Contributor
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
HeartofPhos
approved these changes
Oct 11, 2026
stuartparmenter
approved these changes
Oct 12, 2026
mockersf
approved these changes
Oct 12, 2026
erickpiva
pushed a commit
to erickpiva/bevy
that referenced
this pull request
Oct 12, 2026
bevyengine#26090) …st's # Objective - Fixes bevyengine#26087 - Bevy keeps a GPU buffer of per-mesh dataa (MeshUniform). The shader expects each entry to be 176 bytes. Bevy worked out each entry's size by asking Rust how big the struct is, not how big the shader says it is. Normally both answers are 176, but w/ glam's scalar-math feature on, Rust packs the struct tighter, to 168 bytes. If a render phase draws exactly one mesh, the buffer comes out 168 bytes when the shader needs at least 176, and wgpu throws the binding-size error. With two or more meshes the buffer happens to be big enough, so the bug stays hidden. ## Solution - UninitBufferVec now uses the shader's size for each entry instead of Rust's (one line change boi) ## Testing - A unit test with a struct that's 12 bytes in Rust but 16 in a shader. It fails before the fix and passes after.
barafael
pushed a commit
to barafael/bevy
that referenced
this pull request
Oct 19, 2026
bevyengine#26090) …st's # Objective - Fixes bevyengine#26087 - Bevy keeps a GPU buffer of per-mesh dataa (MeshUniform). The shader expects each entry to be 176 bytes. Bevy worked out each entry's size by asking Rust how big the struct is, not how big the shader says it is. Normally both answers are 176, but w/ glam's scalar-math feature on, Rust packs the struct tighter, to 168 bytes. If a render phase draws exactly one mesh, the buffer comes out 168 bytes when the shader needs at least 176, and wgpu throws the binding-size error. With two or more meshes the buffer happens to be big enough, so the bug stays hidden. ## Solution - UninitBufferVec now uses the shader's size for each entry instead of Rust's (one line change boi) ## Testing - A unit test with a struct that's 12 bytes in Rust but 16 in a shader. It fails before the fix and passes after. (cherry picked from commit 48ae9fc)
barafael
added a commit
to barafael/kernel-panic-bevy
that referenced
this pull request
Oct 19, 2026
Launches sometimes died in the menu with "Binding size 168 of Buffer … MeshUniform … is less than minimum 176" (bevyengine/bevy#26087): with glam's `scalar-math`, which the workspace turns on for deterministic math, `MeshUniform` is 168 bytes in Rust and 176 in WGSL, and `UninitBufferVec` sized its buffer by the Rust size. #26090 (merged into main after 0.20.0) sizes entries by the shader layout; the `kernel-panic-0.20` fork branch now carries it (6fa5f2878). 40 launches afterwards: no render errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
unleashed
pushed a commit
to unleashed/bevy
that referenced
this pull request
Oct 27, 2026
bevyengine#26090) …st's # Objective - Fixes bevyengine#26087 - Bevy keeps a GPU buffer of per-mesh dataa (MeshUniform). The shader expects each entry to be 176 bytes. Bevy worked out each entry's size by asking Rust how big the struct is, not how big the shader says it is. Normally both answers are 176, but w/ glam's scalar-math feature on, Rust packs the struct tighter, to 168 bytes. If a render phase draws exactly one mesh, the buffer comes out 168 bytes when the shader needs at least 176, and wgpu throws the binding-size error. With two or more meshes the buffer happens to be big enough, so the bug stays hidden. ## Solution - UninitBufferVec now uses the shader's size for each entry instead of Rust's (one line change boi) ## Testing - A unit test with a struct that's 12 bytes in Rust but 16 in a shader. It fails before the fix and passes after.
sri443
pushed a commit
to sri443/bevy
that referenced
this pull request
Nov 10, 2026
# Objective - Noticed while reviewing bevyengine#26090 - we store a comp time value in a structure field and only use it internally ## Solution - Directly use the comp time value everywhere
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…st's
Objective
scalar-math(via feature unification) breaks 3D rendering:model_only_mesh_bind_groupbinding size 168 < 176 #26087Solution
Testing